#!/usr/bin/python
#coding=utf-8
import sys
from sys import argv

reload(sys)
sys.setdefaultencoding('utf-8')

script,imageName,server=argv

#print 'type server',type(server),server

servera=server.decode('gbk')
#print 'type servera',type(servera),servera

serverb=servera.decode('utf-8');
#print 'type serverb',type(serverb),serverb

#print '----------------------------------'

import pytesseract
from PIL import Image
import time
#for i in range(1):
        #print(time.time())
baseDir='E:\\pyy\\%s'
im1 = Image.open(baseDir % imageName)
code1 = pytesseract.image_to_string(im1,lang="chi_sim")
#print code1#.encode('utf-8')
#print 'type code',type(code1),code1



if cmp(code1,serverb)==0:
	print 'ok工厅'
else:
	print 'fail'


'''
        #print(time.time())
        #f=open("E:\\pyy\\result.txt","a")
        #f.write("%s"%code1+','+'\n')
        #f.close()
'''

'''   
print(code1.encode('utf-8'))

if code1.encode('utf-8')=='王青96区'.encode('utf-8'):
    print("1")
else:
    print("2")



if code1==b'\xe7\x8e\x8b\xe9\x9d\x9296\xe5\x8c\xba':
    print("1")
else:
    print("2")
'''
